<template>
  <div id="app" class="min-h-screen">
    <!-- 根据路由meta.layout选择不同的布局组件 -->
    <component :is="currentLayout">
      <router-view />
    </component>
  </div>
</template>

<script setup lang="ts">
import { computed, defineAsyncComponent } from 'vue'
import { useRoute } from 'vue-router'

// 导入布局组件
const DefaultLayout = defineAsyncComponent(() => import('@/components/Layout.vue'))
const AuthLayout = defineAsyncComponent(() => import('@/components/AuthLayout.vue'))

// 获取当前路由
const route = useRoute()

// 根据路由meta.layout选择当前布局
const currentLayout = computed(() => {
  const layout = route.meta.layout || 'default'
  switch (layout) {
    case 'auth':
      return AuthLayout
    case 'admin':
      return DefaultLayout // 暂时使用默认布局代替管理后台布局
    default:
      return DefaultLayout
  }
})
</script>

<style>
/* 全局样式重置 */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}
</style>